<template>
  <div class="login-container">
    <el-form
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
      <h2 class="login-title">好易购后台管理系统-登录</h2>
      <el-form-item label="用户名" prop="name">
        <el-input v-model="ruleForm.name"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="psw">
        <el-input v-model="ruleForm.psw"></el-input>
      </el-form-item>
      <el-form-item>
        <!-- `checked` 为 true 或 false -->
        <el-checkbox v-model="checked">7天免登陆</el-checkbox>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" 
          >登录</el-button
        >
        <el-button type="primary" @click="goto"
          >注册</el-button
        >
      </el-form-item>
    </el-form>
  </div>
</template>>

<script>
export default {
  data() {
    return {
      ruleForm: {
        name: "",
        psw: ""
      },
      //表单校验
      rules: {
        name: [
          { required: true, message: "请输入用户名", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        ],
        psw: [
          { required: true, message: "请输入密码", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        ]
      },
      //7天免登陆
      checked: true
    };
  },
  methods: {
      //跳转到注册页
      goto(){
         this.$router.push("/reg")
          
      }
  }
};
</script>


<style scoped >
@import "../../assets/scss/reg.scss";
</style>